﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Devtm.ServiceModel.Proxy.Events;

namespace Devtm.ServiceModel.Proxy
{
    
    public class EventHandlerOperationName
    {

        #region Events

        public event EventHandler<ExceptionEventArgs> OnException;
        public event EventHandler<InterceptBeforeEventArgs> InterceptBeforeAction;
        public event EventHandler<InterceptAfterEventArgs> InterceptAfterAction;
        private ProxyConfiguration proxyConfiguration;

        public EventHandlerOperationName(ProxyConfiguration proxyConfiguration)
        {
            // TODO: Complete member initialization
            this.proxyConfiguration = proxyConfiguration;
        }

        public bool HasExceptionSubscription { get { return OnException != null; } }
        public bool HasInterceptBeforeSubscription { get { return InterceptBeforeAction != null; } }
        public bool HasInterceptAfterSubscription { get { return InterceptAfterAction != null; } }


        internal void EventException(ExceptionEventArgs eventArgs)
        {
            if (OnException != null)
                OnException(this, eventArgs);
        }

        internal void EventInterceptBeforeAction(InterceptBeforeEventArgs eventArgs)
        {
            if (InterceptBeforeAction != null)
                InterceptBeforeAction(this, eventArgs);
        }

        internal void EventInterceptAfterAction(InterceptAfterEventArgs eventArgs)
        {
            if (InterceptAfterAction != null)
                InterceptAfterAction(this, eventArgs);
        }

        #endregion

    }

}
